package com.talent.service.impl;

import com.talent.mapper.SysUserMapper;
import com.talent.model.SysUser;
import com.talent.service.SysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.UUID;

@Service
public class SysUserServiceImpl implements SysUserService {
	
	@Resource
	private SysUserMapper sysUserMapper;

	@Override
	public SysUser getById(Long id) {
		return sysUserMapper.selectByPrimaryKey(id);
	}

	@Override
	public SysUser add(SysUser sysUser){
		sysUser.setSysUserId(UUID.randomUUID().getLeastSignificantBits());
		sysUserMapper.insert(sysUser);
		return sysUserMapper.selectByPrimaryKey(sysUser.getSysUserId());
	}
}
